package com.st.dao.impl;

import com.st.dao.IEmpDao;
import com.st.enity.Emp;
import com.st.util.DBUtil;

import java.util.List;

public class EmpDaoImpl implements IEmpDao{
	private DBUtil dbUtil = new DBUtil();
	@Override
	public List<Emp> selectAll() {
		String sql = "select * from emp";
		return dbUtil.query(sql, null, Emp.class);
	}
	@Override
	public List<Emp> selectByKey(String key) {
		String sql = "select * from emp where eid like ? or ename like ? or ephone like ? or did like?";
		Object[] params = {"%"+key+"%","%"+key+"%","%"+key+"%","%"+key+"%"};
		return dbUtil.query(sql, params, Emp.class);
	}

}
